{% extends 'eform_base_no_nav.html' %}
{% load static %}
{% load i18n %}
{% block title %}
    <title>Form -  CHECK SHEET (Banknote Acceptor, BNA56 & BNA57)</title>
{% endblock title %}
    


{% block head %}
<!-- <link rel='stylesheet' href='https://cdn.form.io/formiojs/formio.full.min.css'> -->
<link rel='stylesheet' href="{% static 'eform/formio.full.min.css' %}">

<style type="text/css" media="print">
/* input:read-only{
        background:white;
    } */
    
    .no-print { display: none; }
    /* div {
        break-inside: avoid;
        page-break-inside: avoid;
    } */
    /* div[ref="component"]{
        break-inside: avoid;
        page-break-inside: avoid;
    } */
    /* #formio div {
        break-inside: avoid;
    } */
    @page { 
        margin-top:0.5cm; 
        margin-bottom: 0.5cm;
        margin-right: 0.5cm;
        margin-left: 0.5cm;
    }
    .col-print-12{width:100% !important;}
    .col-md-10{
        width: 100%  !important;
    }
    body{
        background: none !important;
        background-image: none !important;
    }
  /* body { margin: 1.6cm; } */
  
</style>


<style>
    .print-container{
        display: block;
    }
    input:read-only{
        background:white !important;
    }
    /* div[ref="component"]{
            display: none;
        } */


    body{
        background: none !important;
        background-image: none !important;
    }

    .staff-name{
        
        min-width:180px;
        display: inline-block;
        margin: 0 50px 0 50px;
    }

    .imte-table .row{
        margin: 0;
        padding: 0;
    }
    .imte-table .col{
        margin: 0;
        padding: 5px;
        border: 1px solid black;
    }

    .my-3,.my-5{
        margin-top: 0 !important;
    }
    .mb-3,.mb-5{
        margin-bottom: 0 !important;
    }
    .mt-3,.mt-5{
        margin-top: 0 !important;
    }

    
</style>
{% endblock head %}
    


{% block bodyclass %}
{% endblock bodyclass %}
{% block body %}

<!-- <div class="container-fluid mt-3">
    <button type="button" id="log-data" class="btn btn-primary">Log Data</button>
</div> -->

<br><a name="" id="" class="no-print btn btn-primary mb-3" href="#" onclick="gobackurl({{eform.workOrderList.pk}})" role="button"><i class="fa fa-backward" aria-hidden="true"></i>  Back</a>

<div class="print-container">
                    <!-- <div class="card-header no-print">
                        <h1>{{eform.eformSchema.title}}</h1>
                    </div> -->
                        <div class="row">
                            <div class="col-12 text-dark text-center">
                                <h4><strong>{{eform.title}}</strong></h4><br>
                            </div>
                            <!-- <div class="col-4 ">
                                <div class="form-group">
                                    <label for="form_title">Form Title</label>
                                    <input type="text" readonly value="{{eform.title}}"
                                    class="form-control" name="form_title" id="form_title" aria-describedby="form_title" placeholder="Form Title">
                                </div>
                            </div> -->
                            <div class="col-4 ">
                                <div class="form-group">
                                    <label for="form_no">Form No.</label>
                                    <input type="text" readonly value="{{eform.formNo}} {% if eform.issue %}({{eform.issue}}){% endif %}" 
                                    class="form-control" name="form_no" id="form_no" aria-describedby="form_no" placeholder="Form No.">
                                </div>
                            </div>
                            
                        
                        
                            <div class="col-4 ">
                                <div class="form-group">
                                    <label for="ref">Ref.</label>
                                    <input type="text" readonly value="{{eform.ref}}"
                                    class="form-control" name="ref" id="ref" aria-describedby="ref" placeholder="Ref">
                                </div>
                            </div>

                            <div class="col-4 ">
                                <div class="form-group">
                                    <label for="ref">Form Issue Date</label>
                                    <input type="text" readonly value="{{eform.form_issue_date | date:'Y-m-d'}}"
                                    class="form-control" name="ref" id="ref" aria-describedby="ref" placeholder="Ref">
                                </div>
                            </div>
                       
                        </div>
                            
                        <hr>
                        <div class="row">
                            <div class="col-sm-12 col-md-3 ">
                                <div class="form-group">
                                  <label for="">Serial Number</label>
                                  <input value="{{eform.workOrder.serialno|default:''}}"
                                  type="text" class="form-control" readonly name="line_w_order" id="id_line_w_order" aria-describedby="helpId" placeholder="">
                                </div>    
                            </div>
                            <div class="col-sm-12 col-md-3 ">
                                <div class="form-group">
                                  <label for="">Location</label>
                                  <input value="{{eform.workOrder.location|default:''}}"
                                  type="text" class="form-control" readonly name="location" id="id_location" aria-describedby="helpId" placeholder="">
                                </div>    
                            </div>
                           <div class="col-sm-12 col-md-3 ">
                                <div class="form-group">
                                    <label for="">FAILURE SYMPTOM</label>
                                    <input form="eform" value="{{eform.workOrder.failure_sym|default:''}}" readonly
                                    type="text" class="form-control"  name="wo_failure_sym" id="id_failure_sym" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>
                            <div class="col-sm-12 col-md-3 ">
                                <div class="form-group">
                                  <label for="">RECEIVED DATE</label>
                                  <input value="{{eform.workOrder.received_date}}"
                                  type="text" class="form-control" readonly name="report_date" id="id_report_date" aria-describedby="helpId" placeholder="">
                                </div>    
                            </div>

                        </div>
                        <div class="row">
                            <div class="col-sm-12 col-md-3 ">
                                <div class="form-group">
                                  <label for="">LINE ORDER</label>
                                  <input value="{{eform.workOrder.line_order|default:''}}"
                                  type="text" class="form-control" readonly name="line_w_order" id="id_line_w_order" aria-describedby="helpId" placeholder="">
                                </div>    
                            </div>
                            <div class="col-sm-12 col-md-3 ">
                                <div class="form-group">
                                <label for="">CEWS ORDER</label>
                                <input value="{{eform.workOrder.cews_order}}"
                                type="text" class="form-control" readonly name="cews_w_order" id="id_cews_w_order" aria-describedby="helpId" placeholder="">
                                </div>    
                            </div>
                            
                             <div class="col-sm-12 col-md-6 ">
                                <div class="form-group">
                                    <label for="">CHECKED DATE</label>
                                    <input value="{{eform.workOrder.checked_date}}"
                                    type="text" class="form-control" readonly name="received_date" id="id_received_date" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>
                        </div> 
                        
                        {% comment %} <div class="row">
                            
                            <div class="col-sm-12 col-md-4 ">
                                <div class="form-group">
                                  <label for="">Work Order Type</label>
                                  <input value="{{eform.workOrderList.wo_type|default:''}}"
                                  type="text" class="form-control" readonly name="wo_type" id="id_wo_type" aria-describedby="helpId" placeholder="">
                                </div>    
                            </div>

                            <div class="col-sm-12 col-md-4 ">
                                <div class="form-group">
                                  <label for="">EQPT./CAR NO.</label>
                                  <input value="{{eform.workOrderList.carno|default:''}}"
                                  type="text" class="form-control" readonly name="carno" id="id_carno" aria-describedby="helpId" placeholder="">
                                </div>    
                            </div>
                            
                            <div class="col">
                                <div class="form-group">
                                    <label for="">EQPT. DESCRIPTION</label>
                                    <input value="{{eform.workOrderList.eqip_des|default:''}}"
                                    type="text" class="form-control" readonly name="eqip_des" id="id_eqip_des" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>
                          
                            <div class="col-sm-12 col-md-4 ">
                                <div class="form-group">
                                    <label for="">RETURN TO</label>
                                    <input value="{{eform.workOrderList.return_to|default:''}}"
                                    type="text" class="form-control" readonly name="return_to" id="id_return_to" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>

                            <div class="col-sm-12 col-md-4 ">
                                <div class="form-group">
                                    <label for="">CREATE STAFF</label>
                                    <input value="{{eform.workOrderList.create_staff}}"
                                    type="text" class="form-control" readonly name="create_staff" id="id_create_staff" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>
                           
                            <div class="col-sm-12 col-md-4 ">
                                <div class="form-group">
                                    <label for="">WO RESULT</label>
                                    <input value="{{eform.workOrderList.wo_result|default:''}}"
                                    type="text" class="form-control" readonly name="wo_result" id="id_wo_result" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>


                            <div class="col-sm-12 col-md-4 ">
                                <div class="form-group">
                                    <label for="">CONTRACTOR ORDER NO.</label>
                                    <input value="{{eform.workOrderList.contractor_ref_order|default:''}}"
                                    type="text" class="form-control" readonly name="contractor_ref_order" id="id_contractor_ref_order" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>
                            <div class="col-sm-12 col-md-4 ">
                                <div class="form-group">
                                    <label for="">CHECK OUT DATE</label>
                                    <input value="{{eform.workOrderList.checkout_date|default:''}}"
                                    type="text" class="form-control" readonly name="checkout_date" id="id_checkout_date" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>
                            <div class="col-sm-12 col-md-4 ">
                                <div class="form-group">
                                    <label for="">SEND OUT LOCATION</label>
                                    <input value="{{eform.workOrderList.sendout_location|default:''}}"
                                    type="text" class="form-control" readonly name="sendout_location" id="id_sendout_location" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>
                            
                           


                            
                            

                        </div> {% endcomment %}


                        <div class="row mb-3">
                            <div class="col">
                                <h4>Applied IMTE</h4>
                            </div>
                        </div>
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th>
                                        E.I. / EWS No.
                                    </th>
                                    <th>
                                        DUE DATE
                                    </th>
                                </tr>
                            </thead>
                            <tbody id="imte-tbody">
                                
                                {% for data in imtes %}
                                <tr id="tr-{{data.imte}}">
                                    <td>
                                    {{data.imte}}
                                    </td>
                               
                                    <td>
                                    {{data.due_date|date:'Y-m-d'}}
                                    </td>
                               
                                </tr>
                                {% endfor %}
                                    
                            </tbody>

                        </table>                        
                        <hr>
                        <div id="formio" class="px-2">
                        </div>

                        
                    
                        
                        
                        

                        <div class="row ">
<!-- 
                            <div class="col-6">
                                <div class="form-group">
                                    <label for="">FAILURE SYMPTOM</label>
                                    <input form="eform" value="{{eform.workOrderList.failure_sym|default:''}}"
                                    type="text" class="form-control"  name="wo_failure_sym" id="id_failure_sym" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div> -->

                            <div class="col-6">
                                <div class="form-group">
                                    <label for="">FINDING</label>
                                    <input form="eform" value="{{eform.workOrder.finding|default:''}}"
                                    type="text" class="form-control"  name="wo_finding" id="id_finding" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>
                            <div class="col-6">
                                <div class="form-group">
                                    <label for="">ACTION</label>
                                    <input form="eform" value="{{eform.workOrder.action|default:''}}"
                                    type="text" class="form-control"  name="wo_action" id="id_action" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div>
                            <!-- <div class="col-6">
                                <div class="form-group">
                                    <label for="">REMARKS</label>
                                    <input form="eform" value="{{eform.workOrderList.remarks|default:''}}"
                                    type="text" class="form-control" name="wo_remarks" id="id_remarks" aria-describedby="helpId" placeholder="">
                                  </div>    
                            </div> -->
                        
                            
                        </div>
                        <div class="row">
                            <div class="col text-center">
                                <strong>Overall Test Result: </strong>
                                <div class="form-check form-check-inline mt-0">
                                    <label class="form-check-label">
                                        <input class="form-check-input meta-input " 
                                        {% if eform.overall_test_result == 'Pass' %}
                                            checked
                                        {% endif %}
                                             type="radio" name="overall_test_result_radio" id="" value="Pass"> Pass
                                        <input class="form-check-input meta-input " 
                                        {% if eform.overall_test_result == 'Fail' %}
                                            checked
                                        {% endif %}
                                         type="radio" name="overall_test_result_radio" id="" value="Fail"> Fail
                                    </label>
                                </div>
                            </div>
                        </div>
                        <br>

                        <div class=" mt-1 row text-center  bg-white">
                            <div class="col text-center">
                                <div class="staff-name">
                                    
                                    <small>Done By</small>
                                    <h5>{{eform.doneby}}</h5>
                                    <hr>
                                    <p>{{eform.doneDate}}</p>
                                </div>
                                {% if eform.eformSchema.endorsor_require %}
                                <div class="staff-name">
                                    <small>Verified By</small>
                                    <h5>{{eform.verifiedby}}</h5>
                                    <hr>
                                    <p>{{eform.verifiedDate}}</p>
                                </div>
                                <div class="staff-name">
                                    <small>Endorsed By</small>
                                    <h5>{{eform.endorsedby}}</h5>
                                    <hr>
                                    <p>{{eform.endorsedDate}}</p>
                                </div>
                                {% endif %} 
                            </div>
                        </div>

                        <br>

                        <div class="row text-center">
                            <div class="col">
                                <strong class="">End of Test</strong>
                            </div>
                        </div>
            

</div>
                        
                    
          
            
{% endblock body %}



{% block script %}
<!-- <script src='https://cdn.form.io/formiojs/formio.full.min.js'></script> -->
<script src="{% static 'eform/formio.full.min.js' %}"></script>
<script src="{% static 'api/axios.min.js' %}"></script>

<script src="  https://printjs-4de6.kxcdn.com/print.min.js"></script>
<!-- <script src="{% static 'eform/confirm.js' %}"></script> -->
<!-- <script src="{% static 'eform/pagemap.js' %}"></script> -->
<script>
    // const OCR_DECTECTION_IP = '{{OCR_DETECTION_IP}}'
    var dataJson={{formSchema | safe}}
    var data = {{eform.getFormDataJson |safe}}
    const get_all_imte_url = '{% url "api:imtes-get_imte_by_eform_id" %}'

    // var cssurls = [
    //     "{% static 'eform/formio.full.min.css' %}",
    //     "{% static 'eform/fa/css/all.min.css' %}",
    //     "{% static 'eform/bootstrap/bootstrap_yeti.min.css' %}",
    //     "{% static 'eform/formio/style.css' %}",
    // ]
    // data_object =  data.reduce((obj, item) => (obj[item.key] = item.data, obj) ,{});
    // console.log(data)
    
</script>
<!-- <script src="{% static 'eform/cameraIMTE.js' %}"></script> -->
<script src="{% static 'eform/eformPrint.js' %}" ></script>
<script src="{% static 'eform/checkurl.js' %}"></script>
{% endblock script %}
    
    